home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / com_os2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-07  |  5.0 KB  |  123 lines

  1. #define TRUE 1
  2. #define FALSE 0
  3.  
  4. typedef unsigned char bool;
  5. /*
  6. typedef unsigned char byte;
  7. typedef unsigned short word;
  8. */
  9. extern void com_putc( int c );
  10. extern int  com_putc_now( int c );
  11. extern void com_write(char *buf, int bytes);
  12. extern void com_wait(void);
  13. extern int  com_getchar(void);
  14. extern int  com_peek(void);
  15. extern int  com_char_avail(void);
  16. extern bool com_out_empty(void);
  17. extern bool com_online(void);
  18. extern void com_clear_out(void);
  19. extern void com_clear_in(void);
  20. extern void com_XON_enable(void);
  21. extern void com_XON_disable(void);
  22. extern long com_cur_baud(void );
  23. extern  int com_init(int port, char *pipe);
  24. extern  int com_fini(void);
  25. extern  int com_set_baud(long rate,char parity,int databits,int stopbits);
  26. extern  void com_DTR_on(void );
  27. extern  void com_DTR_off(void );
  28. extern  void com_break(int on);
  29.  
  30. extern  void MDM_ENABLE(int ignore);
  31. extern  void MDM_DISABLE(void );
  32. extern  void BUFFER_BYTE(unsigned char ch);
  33. extern  void UNBUFFER_BYTES(void );
  34. static  void zap_zbuf(void );
  35. extern  int Cominit(int port);
  36. extern int get_key(void);
  37.  
  38. /* translate binkley fossil stuff to my async package */
  39. #define CARRIER            (com_online())
  40. #define CHAR_AVAIL()       com_char_avail()
  41. #define OUT_EMPTY()        com_out_empty()
  42. #define OUT_FULL()         (!com_out_empty())
  43. #define DTR_OFF()          com_DTR_off()
  44. #define DTR_ON()           com_DTR_on()
  45. #define CLEAR_OUTBOUND()   com_clear_out()
  46. #define CLEAR_INBOUND()    com_clear_in()
  47. #define KEYPRESS()         kbhit()
  48. #define READKB()           get_key()
  49. #define FOSSIL_CHAR()      get_key()
  50. #define XON_ENABLE()       com_XON_enable()
  51. #define IN_XON_ENABLE()    com_XON_enable()
  52. #define XON_DISABLE()      com_XON_disable()
  53. #define _BRK_DISABLE()
  54. #define FOSSIL_WATCHDOG(x)
  55. #define SENDBYTE(c)        com_putc(c)
  56. /*#define BUFFER_BYTE(c)     com_putc(c)*/
  57. /*#define UNBUFFER_BYTES()   com_wait() */
  58. #define MODEM_IN()         com_getchar()
  59. #define WRITE_ANSI(c)      putchar(c)
  60. #define PEEKBYTE()         com_peek()
  61. #define do_break(on)       com_break(on)
  62. #define SENDCHARS(buf, size, carcheck) com_write(buf, size)
  63. #define Com_Tx_NW(c)        com_putc_now(c)
  64.  
  65. #define real_flush(fh)     DosBufReset(fh)
  66.  
  67. /* some usefull bits */
  68. #define RLSD  0x80         /* (MSR) Received line signal detect,
  69.                   * sometimes called Carrier Detect */
  70. #define THRE 0x20         /* (LSR) Transmitter holding register empty
  71.                   * (ready for another byte) */
  72. #define DR   0x1         /* (LSR) Data ready indicator */
  73. #define OE   0x2         /* (LSR) Overrun error! We are not reading the
  74.                   * bytes fast enuf */
  75.  
  76. #if defined(OS2_INCLUDED)
  77.  
  78. /* OS/2 Category 1 DosDevIoctl() calls */
  79. #define SERIAL          1       /* category: serial device control */
  80. #define ASYNC_SETBAUDRATE    0x41  /* Sets baud rate                                 */
  81. #define ASYNC_SETLINECTRL    0x42  /* Sets line characteristics for serial device    */
  82. #define ASYNC_TRANSMITIMM    0x44  /* Transmits byte immediately                     */
  83. #define ASYNC_SETBREAKOFF    0x45  /* Sets break off                                 */
  84. #define ASYNC_SETMODEMCTRL   0x46  /* Sets modem control register                    */
  85. #define ASYNC_STOPTRANSMIT   0x47  /* Stops device from transmitting                 */
  86. #define ASYNC_STARTTRANSMIT  0x48  /* Starts a transmission                          */
  87. #define ASYNC_SETBREAKON     0x4b  /* Sets break on                                  */
  88. #define ASYNC_SETDCBINFO     0x53  /* Sets device control block information          */
  89. #define ASYNC_GETBAUDRATE    0x61  /* Retrieves current baud rate                    */
  90. #define ASYNC_GETLINECTRL    0x62  /* Gets line characterstics of serial device      */
  91. #define ASYNC_GETCOMMSTATUS  0x64  /* Retrieves communications status                */
  92. #define ASYNC_GETLINESTATUS  0x65  /* Retrieves current line status                  */
  93. #define ASYNC_GETMODEMOUTPUT 0x66  /* Retrieves modem-control output signals         */
  94. #define ASYNC_GETMODEMINPUT  0x67  /* Retrieves modem control register               */
  95. #define ASYNC_GETINQUECOUNT  0x68  /* Retrieves number of characters in input queue  */
  96. #define ASYNC_GETOUTQUECOUNT 0x69  /* Retrieves number of characters in output q     */
  97. #define ASYNC_GETCOMMERROR   0x6d  /* Retrieves communications error                 */
  98. #define ASYNC_GETCOMMEVENT   0x72  /* Retrieves communications event mask            */
  99. #define ASYNC_GETDCBINFO     0x73  /* Retrieves device control block information     */
  100.  
  101. #define GENERIC         11      /* category: generic device control commands */
  102. #define FLUSHINPUT      1       /* function: flush input buffer */
  103. #define FLUSHOUTPUT     2       /* function: flush output buffer */
  104.  
  105. typedef struct _DCBINFO {
  106.     USHORT usWriteTimeout;
  107.     USHORT usReadTimeout;
  108.     BYTE   bFlags1;
  109.     BYTE   bFlags2;
  110.     BYTE   bFlags3;
  111.     BYTE   bErrorReplacementChar;
  112.     BYTE   bBreakReplacementChar;
  113.     BYTE   bXONChar;
  114.     BYTE   bXOFFChar;
  115. } DCBINFO;
  116.  
  117. typedef struct _RXQUEUE {
  118.     USHORT cbChars;
  119.     USHORT cbQueue;
  120. } RXQUEUE;
  121.  
  122. #endif
  123.